package com.itheima;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RequestController {

    @RequestMapping("/request")
   public String request(HttpServletRequest request){
        // 获取请求方式
        String method = request.getMethod();
        System.out.println("method:"+method);
        //获取请求路径
        String requestURI = request.getRequestURI();
        System.out.println("requestURI:"+requestURI);
        //获取请求参数
        String queryString = request.getQueryString();
        System.out.println("queryString:"+queryString);
        // 获取请求协议
        String protocol = request.getProtocol();
        System.out.println("protocol:"+protocol);
        // 获取请求头
        String header = request.getHeader("User-Agent");
        System.out.println("header:"+header);
        return "success";
   }
}
